import 'dart:core';

import 'package:isar/isar.dart';
import 'package:path_provider/path_provider.dart';

part 'isar.g.dart';
part 'isar_api_info.dart';
part 'isar_relax_info.dart';
part 'isar_worknote_info.dart';

late Isar isar;

initIsar() async {
  final dir = await getApplicationDocumentsDirectory();
  isar = Isar.open(
      schemas: [ApiInfoSchema, RelaxInfoSchema, WorkNoteInfoSchema],
      directory: dir.path,
      engine: IsarEngine.sqlite);
}

@collection
class ApiInfo {
  int id = 0;
  String? name;
  String? url;
  String? info;

  ApiInfo();
}

@collection
class RelaxInfo {
  int id = 0;
  String date = '';
  int count = 0;
  int? state; // 0-未完成 1-完成

  RelaxInfo();
}

@collection
class WorkNoteInfo {
  int id = 0;
  String date = '';
  String content = '';

  WorkNoteInfo();
}
